﻿using System.Configuration;

namespace SouslikPod.Configuration
{
    public class CommandConfigSection : ConfigurationSection
    {

        [ConfigurationProperty("Commands")]
        public CommandsCollection Commands
        {
            get { return ((CommandsCollection)(base["Commands"])); }
        }
    }

    [ConfigurationCollection(typeof(CommandElement))]

    public class CommandsCollection : ConfigurationElementCollection
    {

        protected override ConfigurationElement CreateNewElement()
        {
            return new CommandElement();
        }


        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((CommandElement)(element)).CommandName;
        }


        public CommandElement this[int idx]
        {
            get
            {
                return (CommandElement)BaseGet(idx);
            }
        }

    }

    public class CommandElement : ConfigurationElement
    {

        [ConfigurationProperty("CommandName", DefaultValue = "", IsKey = true, IsRequired = true)]
        public string CommandName
        {
            get
            {
                return ((string)(base["CommandName"]));
            }
            set
            {
                base["CommandName"] = value;
            }

        }



        [ConfigurationProperty("CommandClassName", DefaultValue = "", IsKey = false, IsRequired = false)]
        public string CommandClassName
        {

            get
            {
                return ((string)(base["CommandClassName"]));
            }

            set
            {
                base["CommandClassName"] = value;

            }
        }


        [ConfigurationProperty("AssemblyName", DefaultValue = "", IsKey = false, IsRequired = false)]
        public string AssemblyName
        {

            get
            {
                return ((string)(base["AssemblyName"]));
            }

            set
            {
                base["AssemblyName"] = value;

            }
        }
    }
}
